/**
 * Copyright (c) 2002-2012 旭鸣信息
 * All rights reserved. 
 * File：WelcomeController.java
 * History: Nov 13, 2013: Initially created, liuzhi.
 */
package com.xteam.ecsystem.contorller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xteam.ecsystem.service.admin.WelcomeService;

/**
 * 欢迎界面数据初始化控制器
 * @author liuzhi
 *
 */
@Controller
public class WelcomeController {
	
	@Autowired
	private WelcomeService welService;

	public void setToBeJsonType(HttpServletRequest request, HttpServletResponse response) {
		response.setContentType("application/json;charset=UTF-8");
	};
	
	/**
	 * 加载未确认订单数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadWqrdd.do")
	public void loadWqrdd(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadWqrdd();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载待支付订单数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadDzfdd.do")
	public void loadDzfdd(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadDzfdd();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载待发货订单数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadDfhdd.do")
	public void loadDfhdd(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadDfhdd();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载已成交订单数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadYcjdd.do")
	public void loadYcjdd(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadYcjdd();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载商品总数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadSpzsm.do")
	public void loadSpzsm(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadSpzsm();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载商品警告数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadSpjgs.do")
	public void loadSpjgs(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadSpjgs();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载商品精品数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadJptjs.do")
	public void loadJptjs(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadJptjs();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载商品新品数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadXptjs.do")
	public void loadXptjs(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadXptjs();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载热销商品数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadRxsps.do")
	public void loadRxsps(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadRxsps();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载团购商品数目
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadTgsps.do")
	public void loadTgsps(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadTgsps();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载网站 pv总值
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadWebfwzs.do")
	public void loadWebfwzs(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadWebfwzs();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载网站 今日访问pv值
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadWebjrfw.do")
	public void loadWebjrfw(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadWebjrfw();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载网站 每日平均pv值
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadWebmrpj.do")
	public void loadWebmrpj(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadWebmrpj();
		response.getWriter().write(count.toString());
	}
	
	/**
	 * 加载网站 历史最高pv值
	 * @author liuzhi Nov 13, 2013
	 * @param request
	 * @param response
	 * @param modelMap
	 * @throws IOException
	 */
	@RequestMapping("/loadWeblszg.do")
	public void loadWeblszg(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws IOException {
		setToBeJsonType(request, response);
		
		Long count = this.welService.loadWeblszg();
		response.getWriter().write(count.toString());
	}
}
